[13.x] Fix TrustProxies at:* when multiple proxies are used#60726
Merged
Conversation
Update TrustProxies to add all intermediate IP addresses to trusted list
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
mattford
marked this pull request as ready for review
July 10, 2026 10:43
bert-w
reviewed
Jul 10, 2026
…l address instead of gathering all IPs from the request
mattford
commented
Jul 14, 2026
| * @param \Illuminate\Http\Request $request | ||
| * @return void | ||
| */ | ||
| protected function setTrustedProxyIpAddressesToTheCallingIp(Request $request) |
Contributor
Author
There was a problem hiding this comment.
I have kept this method name the same for now to preserve the contract for anyone extending this class however I am aware it now doesn't reflect what it's actually doing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update TrustProxies to trust a catchall address for IPv4 and IPv6 when trust all proxies is specified
Currently, only the remote address is trusted when using TrustProxies:*. If there are multiple proxies this results in the most recent proxy being treated as the original client IP.
There are tests for this however they were incorrect, treating the last IP in the X-Forwarded-For or Forwarded header list as the original, however it should be the first one (https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-For)
Resolves #60725